<% time='' %>
<div class=page_head>
<h2><%="Listing writeboards".t%></h2>
</div>
<%if @writeboards.size == 0%>
 <div class=tour> 
   <h2><%=link_to "Post the first writeboard for this project".t,new_writeboard_url(params[:project_id])%></h2>
   <%="Collaborate editing in your project. It's very easy!".t%>
 </div>
 <%=feature'writeboard'%>
<%end%>

<table class="data">
<% for writeboard in @writeboards %>
<%if time != writeboard.created_at.strftime("%Y-%m-%d")%>
  <%time = writeboard.created_at.strftime("%Y-%m-%d")%>
  <tr><td colspan=2><%=time_flag(writeboard.created_at)%></td></tr>
<%end%>
  <tr>
    <td style="border:0"><h3><%=link_to writeboard.name,writeboard_path(@project.id,writeboard)%></h3></td>
    <td style="border:0" width=15% align =right><%="in".t%>:<%=link_to(writeboard.category.name,project_wb_in_category_url(writeboard.project.id,writeboard.category.id)) rescue link_to("uncategorized".t,project_wb_in_category_url(writeboard.project,"uncat"))%></td>
  </tr>
  <tr style="color:#666">
    <td colspan=2>
     <span class="float_right">
     <%= link_to 'Edit'.t, edit_writeboard_path(@project.id,writeboard),:class=>'admin'%> <%= link_to image_tag("trash.gif",:border=>0), writeboard_path(@project.id,writeboard), :confirm => 'Are you sure?'.t, :method => :delete %>
     </span>
       <%="Posted by".t%>: <%=h writeboard.user.name%>(<%=h writeboard.created_at.strftime('%y-%m-%d %H:%M') %>)
       <%if writeboard.wikis.size > 1%>
         <%="Last updated by".t%>: <%=h writeboard.wikis.first.user.name%>(<%=h writeboard.wikis.first.created_at.strftime('%y-%m-%d %H:%M') %>) 
	 [<%="Versions".t%>:<%=writeboard.wikis.size%>]
       <%end%>
     </td>
  </tr>
<% end %>   
</table>


<div class="float_right page">
  <%if @writeboard_pages.length > 1%>
   Pages:
  <%end%>
  <% if params[:category_id] %>
   <%=pagination_links @writeboard_pages,:params=>{:controller=>'redirect',:url=> project_wb_in_category_url(params[:project_id],params[:category_id])}%>
  <%else%>
    <%= link_to '<<', writeboards_path(params[:project_id]) + "?page=" + @writeboard_pages.current.previous.to_i.to_s if @writeboard_pages.current.previous %>
   <%=pagination_links @writeboard_pages%>
    <%= link_to '>>', writeboards_path(params[:project_id]) + "?page=" + @writeboard_pages.current.next.to_i.to_s if @writeboard_pages.current.next%>
  <%end%>
</div>
